#include "Rock.h"
#include "Box.h"
#include "RSManager.h"
#include "Sprite.h"
#include "Box.h"
#include "GameDefine.h"



Rock::Rock(Box* box) : Object(box, ObjEnemy_STATIC), MoveObject()
{
}


Rock::~Rock(void)
{
}

void Rock::init()
{
	this->_sprite = RSManager::getInstance()->getSprite(ROCK);
	time_animation = 0;
	_box->_size = _sprite->getRenderSize();
	this->AssignMove(_box);
}

void Rock::update()
{
	if(isOnSpace())
	{
		_box->_v.y = -0.9f;
	}
	
	move();
	time_animation += GAME_TIME;
	if(time_animation > 40)
	{
		time_animation = 0;
		_sprite->Next();
	}
}

void Rock::render()
{
	_sprite->Render(_box->_position);
}

Box* Rock::getCollisionBox()
{
	return _box;
}
